package com.example.music.controller;

import com.example.music.service.UploadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName UploadController
 * @Author: wx
 * @Create: 2022-10-06  16:01
 * @Description TODO
 * @Version: 1.0
 **/
@RestController
@RequestMapping(value = "/upload")
@Api("上传图片")
public class UploadController {
    @Autowired
    private UploadService service;
    @ApiOperation("上传图片到服务器")
    @PostMapping("/image")
    public String pictureUpload(@RequestParam("uploadImage") MultipartFile uploadImage) {
        return service.uploadImage(uploadImage,null);
    }

    @ApiOperation("上传歌曲到服务器")
    @PostMapping("/song")
    public String songUpload(@RequestParam("song") MultipartFile song) {
        return service.uploadSong(song);
    }
}
